﻿using MES.Core;
using MES.Model.System;

namespace MES.Service.System.Permission
{
    public class PermissionServer : IPermissionServer
    {
        private readonly IDataBaseService _dataBaseService;

        public PermissionServer(IDataBaseService dataBaseService)
        {
            _dataBaseService = dataBaseService;
        }

        /// <summary>
        /// 添加权限
        /// </summary>
        /// <param name="permission"></param>
        /// <returns></returns>
        public async Task<OperateResult> AddPermissionAsync(Sys_Permission permission)
        {
            var res = await _dataBaseService.sqlSugarClient.Insertable(permission).ExecuteCommandAsync();

            if (res > 0)
            {
                return OperateResult.Success("添加成功");
            }
            else
            {
                return OperateResult.Fail("添加失败");
            }
        }
    }
}
